



<div class="nav_left">
	<div>
<div id="ship_area">
	<div class="sel_box">
		<div class="sel_val" style="font-weight: bolder"><?php echo $_SESSION['address']; ?></div>
		<div class="sel_arrow" style="background: #7e7e7e;"><div class="arrow"></div></div>
		<div class="sel_option none">
			<div class="close" onclick="$(this).parent().hide();">close</div>
			<div class="opt_top">
				<div class="opt_province opt_box" data-index="0" data="<?php echo $_SESSION['consignee']['province']; ?>" onclick="region_click2(0);">
					<div class="text"><?php echo $_SESSION['consignee']['province_name']; ?></div>
					<div class="arrow"></div>
				</div>
				<div class="opt_city opt_box" data-index="1" data="<?php echo $_SESSION['consignee']['city']; ?>" onclick="region_click2(1);">
					<div class="text"><?php echo $_SESSION['consignee']['city_name']; ?></div>
					<div class="arrow"></div>
				</div>
				<div class="opt_district opt_box cur" data-index="2" data="<?php echo $_SESSION['consignee']['district']; ?>" onclick="region_click2(2);">
					<div class="text"><?php echo $_SESSION['consignee']['district_name']; ?></div>
					<div class="arrow"></div>
				</div>
			</div>
			<div class="opt_con">
				<ul class="opt data_type_0 none" data-type='0'>
					<li><span data=''>XXXXX</span></li>
				</ul>
				<ul class="opt data_type_1 none" data-type='1'>
					<li><span data=''>XXXXX</span></li>
				</ul>
				<ul class="opt data_type_2" data-type='2'>
					<li><span data=''>XXXXX</span></li>
				</ul>
			</div>
		</div>
	</div>
	<form action="alork_region.php" id="ship_area_form" method="post">
		<input type="hidden" id="ship_area_district" name="district" value="0"/>
		<input type="hidden" id="dds_area" name="daodansong" value="0"/>
	</form> 
</div>

<script type="text/javascript">
	// 配送地区js
	function region_click2(type){
		if(type == 0){
			$('.opt_province').addClass('cur').siblings().removeClass('cur');
			$('.opt_city').attr('data', parent).find('.text').text('请选择市');
			$('.opt_district').attr('data', parent).find('.text').text('请选择区');
			$('.data_type_0').show().siblings().hide();
		}
		if(type == 1){
			$('.opt_city').addClass('cur').siblings().removeClass('cur');
			$('.opt_district').attr('data', parent).find('.text').text('请选择区');
			$('.data_type_1').show().siblings().hide();
		}
		if(type == 2){
			$('.opt_district').addClass('cur').siblings().removeClass('cur');
			$('.data_type_2').show().siblings().hide();
		}
	}

	$(function(){
		$('#ship_area .sel_box').mouseenter(function(){
			$('.sel_option').show();
		});
		$('#ship_area .sel_box').mouseleave(function(){
			if($('.opt_district').find('.text').text() != '请选择区'){
				$('.sel_option').hide();
			}
		});
		$('.dds_box').mouseenter(function(){
			$('.dds_con').show();
		});
		$('.dds_box').mouseleave(function(){
			$('.dds_con').hide();
		});
		function region_click(type, parent){
			$('#ship_area .opt span').unbind('click');
			$('#ship_area .opt span').bind('click',function(){
				var type = $(this).parent().parent().attr("data-type");
				var parent = $(this).attr('data');
				if(type == 0){
					var target = 'data_type_1';
					$('.opt_province').attr('data', parent).find('.text').text($(this).text());
					$('.opt_city').attr('data', parent).find('.text').text('请选择市');
					$('.opt_district').attr('data', parent).find('.text').text('请选择区');
					$('.data_type_0').hide();
					$('.data_type_1').show();
					$('.opt_city').addClass('cur').siblings().removeClass('cur');
					region_change(parent, 2, target);
				}
				if(type == 1){
					var target = 'data_type_2';
					$('.opt_city').attr('data', parent).find('.text').text($(this).text());
					$('.opt_district').attr('data', parent).find('.text').text('请选择区');
					$('.data_type_1').hide();
					$('.data_type_2').show();
					$('.opt_district').addClass('cur').siblings().removeClass('cur');
					region_change(parent, 3, target);
				}
				if(type == 2){
					$('.opt_district').attr('data', parent).text($(this).text());
					$('#ship_area_district').val(parent).parent().submit();
				}
			});
		}
		function region_change(parent, type, target){
			var url='region.php';
			htmlobj = $.ajax({url:url+'?r='+Math.random(),type:'post',data:{type:type,parent:parent,target:target},async:false,dataType:'json',success:function(msg){
				html = '';
				region = msg.regions;
				$.each(region,function(k,v){
					html += '<li><span data="'+v.region_id+'">'+v.region_name+'</span></li>';		
				});
				$('.'+target).html(html);
				region_click();
			}});
		}
		region_change('1', 1, 'data_type_0');
		region_change('<?php echo $_SESSION['consignee']['province']; ?>', 2, 'data_type_1');
		region_change('<?php echo $_SESSION['consignee']['city']; ?>', 3, 'data_type_2');
	});
	// 配送地区js end
</script>
	</div>
<?php if ($this->_var['daodansong_is']): ?>
	<span style="float: left;height: 32px;line-height: 32px;margin-left:5px; font-weight: normal; color:#0000;">鸡蛋配送：
	<span style="color: #7c7c7c">以下集训地区可 <font style="color: #8b0409;">	半日送达</font>，由导蛋快递配送</span>
	</span>
<div class="dds_box">
	<div class="dds_val"><?php echo empty($this->_var['daodansong']['area_name']) ? 选择集训区 : $this->_var['daodansong']['area_name']; ?><div class="dds_arrow"></div></div>
	<ul class="dds_con none">
		<?php $_from = $this->_var['daodansong_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item_0_47894000_1443510990');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['item_0_47894000_1443510990']):
?>
		<li><span onclick="$('#dds_area').val(<?php echo $this->_var['item_0_47894000_1443510990']['area_id']; ?>);$('#ship_area_form').submit();"><?php echo $this->_var['item_0_47894000_1443510990']['area_name']; ?></span></li>
		<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
	</ul>
</div>
<?php endif; ?>
</div>